package com.siasun.vaemrd.controller;

import jakarta.servlet.http.HttpServletRequest;

import java.util.Enumeration;

public class RestfulControllerHelper {
    public static void logRequestContext(HttpServletRequest request,org.slf4j.Logger log) {
        // 打印请求基本信息
        log.info("Request URL: {}", request.getRequestURL());
        log.info("Request Method: {}", request.getMethod());
        // 打印请求头
        Enumeration<String> headerNames = request.getHeaderNames();
        while (headerNames.hasMoreElements()) {
            String headerName = headerNames.nextElement();
            log.info("Header: {} = {}", headerName, request.getHeader(headerName));
        }
    }
}
